package com.xtedu.examproject.service;

import com.xtedu.examproject.dao.base.TeacherCourseDao;
import com.xtedu.examproject.dao.impl.TeacherCourseDaoImpl;
import com.xtedu.examproject.entity.TeacherCourse;

import java.util.List;

public class TeacherCourseService {
    private TeacherCourseDao teacherCourseDao;

    public TeacherCourseService(){
        teacherCourseDao = new TeacherCourseDaoImpl();
    }

    public int insertTeacherCourse(TeacherCourse teacherCourse) throws Exception {
        return teacherCourseDao.insert(teacherCourse);
    }

    public int deleteTeacherCourse(TeacherCourse teacherCourse) throws Exception {
        return teacherCourseDao.delete(teacherCourse);
    }

    public int updateTeacherCourse(TeacherCourse teacherCourse) throws Exception {
        return teacherCourseDao.update(teacherCourse);
    }

    public TeacherCourse findByTeacherIdAndCourseId(int teacherId,int courseId) throws Exception {
        return teacherCourseDao.findByTeacherIdAndCourseId(teacherId,courseId);
    }

    public TeacherCourse findTeacherCourseById(int id) throws Exception {
        return teacherCourseDao.findById(id);
    }

    public List<TeacherCourse> findAllTeacherCourse() throws Exception {
        return teacherCourseDao.findAll();
    }
}
